<!DOCTYPE html>
<html lang="en">
  <head>
    <meta charset="UTF-8" />
    <meta http-equiv="X-UA-Compatible" content="IE=edge" />
    <meta name="viewport" content="width=device-width, initial-scale=1.0" />
    <title>Document</title>
  </head>
  <body>
    <div id="app">
      <h2>深层响应式</h2>
      <!-- 在vue3中，只要改变数据，不管改了哪一层，响应式会一直有效 -->
      <p>count: {{ count }}</p>
      <button v-on:click="count++">btn</button>

      <hr />

      <p>obj: {{ obj }}</p>
      <button v-on:click="obj.age = 30">btn2</button>
      <button v-on:click="obj.sex = 1">btn3</button>
    </div>

    <script src="./lib/Vue3.js"></script>
    <script>
      const { createApp } = Vue;

      createApp({
        data() {
          return {
            count: 1,
            obj: {
              name: "zhangsan",
              age: 20,
            },
          };
        },
      }).mount("#app");
    </script>
  </body>
</html>
